from django.core.mail import send_mail

from celery_tasks.main import app


@app.task(name="send_verify_mail")
def send_verify_mail(subject, html_message, recipient_list):
    subject = subject
    html_message = html_message
    from_email = "xk15635661302@163.com"
    recipient_list = recipient_list
    try:
        send_mail(subject=subject, message=html_message, from_email=from_email, recipient_list=recipient_list,
                  html_message=html_message)
    except Exception as e:
        print("发送邮件失败", e)
